home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
windows
/
editprog
/
newvisda.arj
/
FILTER.FRM
< prev
next >
Wrap
Text File
|
1994-04-01
|
6KB
|
227 lines
VERSION 2.00
Begin Form fFilter
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Filter"
ClientHeight = 2370
ClientLeft = 3390
ClientTop = 3675
ClientWidth = 5070
ControlBox = 0 'False
Height = 2835
Left = 3300
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2412
ScaleMode = 0 'User
ScaleWidth = 5160
Top = 3300
Width = 5250
Begin ListBox cFieldList
BackColor = &H00FFFFFF&
Height = 1395
Left = 240
TabIndex = 2
Tag = " OL"
Top = 360
Width = 1695
End
Begin ListBox cOpsList
BackColor = &H00FFFFFF&
Height = 1395
Left = 2040
TabIndex = 7
Tag = " OL"
Top = 360
Width = 960
End
Begin TextBox cExpr
BackColor = &H00FFFFFF&
Height = 287
Left = 3120
TabIndex = 1
Tag = " OL"
Top = 360
Width = 1811
End
Begin CommandButton OkayButton
Caption = "&OK"
Default = -1 'True
Enabled = 0 'False
Height = 372
Left = 600
TabIndex = 4
Top = 1919
Width = 1691
End
Begin CommandButton CancelButton
Cancel = -1 'True
Caption = "&Cancel"
Height = 372
Left = 2879
TabIndex = 5
Top = 1919
Width = 1691
End
Begin Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Do not use quotes"
Height = 195
Left = 3195
TabIndex = 8
Top = 720
Width = 1605
End
Begin Label OpsLabel
BackColor = &H00C0C0C0&
Caption = "Operators:"
Height = 192
Left = 2039
TabIndex = 6
Top = 120
Width = 971
End
Begin Label FieldListLabel
BackColor = &H00C0C0C0&
Caption = "Fields:"
Height = 192
Left = 240
TabIndex = 3
Top = 120
Width = 1092
End
Begin Label ExprLabel
BackColor = &H00C0C0C0&
Caption = "Value or Expression:"
Height = 192
Left = 3120
TabIndex = 0
Top = 120
Width = 1811
End
End
Option Explicit
Dim FNotFound As Integer
Sub CancelButton_Click ()
Hide
'set the flag for the dynaset/dynagrid form
gfFindFailed = True
End Sub
Sub cExpr_Change ()
If cFieldList <> "" And cOpsList <> "" And cExpr <> "" Then
OkayButton.Enabled = True
Else
OkayButton.Enabled = False
End If
End Sub
Sub cExpr_KeyPress (keyascii As Integer)
If keyascii = 34 Or keyascii = 39 Then
keyascii = 0
End If
End Sub
Sub cFieldList_Click ()
If cFieldList <> "" And cOpsList <> "" And cExpr <> "" Then
OkayButton.Enabled = True
Else
OkayButton.Enabled = False
End If
End Sub
Sub cOpsList_Click ()
If cFieldList <> "" And cOpsList <> "" And cExpr <> "" Then
OkayButton.Enabled = True
Else
OkayButton.Enabled = False
End If
End Sub
Sub Form_Load ()
FNotFound = False
cOpsList.AddItem "="
cOpsList.AddItem "<>"
cOpsList.AddItem ">="
cOpsList.AddItem "<="
cOpsList.AddItem ">"
cOpsList.AddItem "<"
cOpsList.AddItem "Like"
End Sub
Sub Form_Paint ()
Outlines Me
End Sub
Sub OkayButton_Click ()
Dim i As Integer
Dim isit As Variant
On Error GoTo FindErr
FNotFound = False
SetHourGlass Me
gstFindField = cFieldList
gstFindExpr = cExpr
gstFindOp = cOpsList
isit = cExpr
'see if it's a date field
If IsDate(isit) Then
i = InStr(1, gstFindField, " ")
If i > 0 Then
FilterStr = "[" + gstFindField + "]" + " " + gstFindOp + " " + "#" + gstFindExpr + "#"
Else
FilterStr = gstFindField + " " + gstFindOp + " " + "#" + gstFindExpr + "#"
End If
Hide
GoTo Findend
'Stop'
End If
If IsNumeric(isit) Then
' pass it, it's a number but put quotes around field name
i = InStr(1, gstFindField, " ")
If i > 0 Then
FilterStr = "[" + gstFindField + "]" + " " + gstFindOp + " " + gstFindExpr
Else
FilterStr = gstFindField + " " + gstFindOp + " " + gstFindExpr
End If
Else
' put quotes around expression if a space is in it
i = InStr(1, gstFindField, " ")
If i > 0 Then
FilterStr = "[" + gstFindField + "]" + " " + gstFindOp + " " + Chr(34) + gstFindExpr + Chr(34)
Else
FilterStr = gstFindField + " " + gstFindOp + " " + Chr(34) + gstFindExpr + Chr(34)
End If
End If
Hide
GoTo Findend
FindErr:
If Err <> EOF_ERR Then
ShowError
Resume Findend
Else
FNotFound = True
Resume Next
End If
Findend:
ResetMouse Me
End Sub